package Game;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.rtscup.core.Building;

import Basic.Point;

public class BlackboardTwo {

	private HashMap<Integer, Integer> enemyBuildingsMark;

	private Map<Integer, Point> intendingTiles;

	private static BlackboardTwo instance;

	public static BlackboardTwo getInstance(ArrayList<Building> enemyBuildings) {
		if (instance == null) {
			instance = new BlackboardTwo(enemyBuildings);
		}
		return instance;
	}

	private BlackboardTwo(ArrayList<Building> enemyBuildings) {
		this.enemyBuildingsMark = new HashMap<Integer, Integer>();

		for (Building b : enemyBuildings) {
			this.enemyBuildingsMark.put(b.getId(), b.getHp());
		}

		this.intendingTiles = new HashMap<Integer, Point>();
	}

	public void putIntending(Integer key, Point intendingPoint) {
		this.intendingTiles.put(key, intendingPoint);
	}

	public List<Point> getIntendings(Integer key) {
		List<Point> ret;

		ret = new ArrayList<Point>();
		for (Integer intendingKey : this.intendingTiles.keySet()) {
			if (!key.equals(intendingKey)) {
				ret.add(this.intendingTiles.get(intendingKey));
			}
		}
		return ret;
	}

	public HashMap<Integer, Integer> getEnemyBuildingsMark() {
		return enemyBuildingsMark;
	}

	public void setEnemyBuildingsMark(HashMap<Integer, Integer> enemyBuildingsMark) {
		this.enemyBuildingsMark = enemyBuildingsMark;
	}

	public boolean hasAvaiableBuilding() {
		return true;
	}

}
